<section class="block">
	<h1 class="block-title">Your notifications</h1>
	
	<div class="block-content">
		<div style="padding: 20px 40px;">
			<?php if ( !empty($user_messages) ) {
				printf('<h5>Messages:</h5>');

				printf('<div class="user-messages clearfix" id="user_messages">');
				foreach($user_messages as $message) {
					$user = $message->user;

					printf('<div class="message clearfix">');

					printf('<p class="lead"><strong><a target="_blank" href="%s">%s</a></strong> send you a message:</p>', $user->profileUrl, $user->name);
					printf('<div class="message-content">');
					printf('<p>%s</p>', $message->message);

					if ( $message->type == 'A' ) { // action message
						$accept_url = $this->createUrl('/user/actionMessage', array('message_id' => $message->message_id, 'act' => 'accept'));
						$reject_url = $this->createUrl('/user/actionMessage', array('message_id' => $message->message_id, 'act' => 'reject'));
						printf('<div class="actions"><a rel="nofollow" href="%s">Accept</a> &nbsp; | &nbsp; <a rel="nofollow" href="%s">Do not Accept</a></div>', $accept_url, $reject_url);
					}

					printf('</div>');


					printf('</div>');
				}
				printf('</div>');
			} ?>

			<?php if ( !empty($friend_requests) ) {
				printf('<h5>Friend request:</h5>');
				
				printf('<div class="friend-requests clearfix" id="friend_requests">');
				foreach ($friend_requests as $req) {
					
					$user = $req->from;
					
					printf('<div class="request clearfix">');
					
					printf('<a class="thumbnail" href="%s">', $user->profileUrl);
					$this->renderPartial('//common/image', array('pair' => $user->avatar, 'object_type' => 'user', 'width' => 80, 'height' => 80));
					printf('</a>');
					
					printf('<a class="name" href="%s">%s</a>', $user->profileUrl, userDisplayName($user));
					
					printf('<div class="buttons">');
					printf('<a class="cm-ajax button button2" href="%s">Accept</a>', $user->acceptFriendUrl);
					printf('&nbsp; <a class="cm-ajax button button2" href="%s">Từ chối</a>', $user->rejectFriendUrl);
					printf('</div>');
					
					printf('</div>');
				}
				printf('<!--friend_requests--></div>');
				
			} ?>

		</div>
	</div>
</section>